package com.example.springboothikaricp.controller;

import com.example.springboothikaricp.service.ComprehensiveCfgService;

import com.example.springboothikaricp.utils.DbUtil;
import com.hjkj.webservice.server.transaction.ConnectionContextHolder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


import java.sql.Connection;
import java.sql.SQLException;


/**
 * 登录
 */
@RestController
public class demoController {

    @PostMapping("/createdb")
    public String createdb() throws SQLException {
        Connection globalConnection = DbUtil.getConnection();
        ConnectionContextHolder.set(globalConnection);
        ComprehensiveCfgService.findBizTree("1");

//        Connection connection = DbUtil.getConnection();
//        Statement statement = null;
//        statement = connection.createStatement();
//        String sql = "SELECT * FROM test ";
//        ResultSet resultSet = statement.executeQuery(sql);
//        // 处理结果集
//        while (resultSet.next()) {
//            int id = resultSet.getInt("id");
//            System.out.println("ID: " + id );
//        }
//        System.out.println("通了");
//        connection.close();
        return null;
    }
    @PostMapping("/createdbLink")
    public String createdbLink() throws SQLException {
        Connection globalConnection = DbUtil.getConnection();
        ConnectionContextHolder.set(globalConnection);
        return null;
    }
}
